A relational database is a database that has a collection of tables of data items, all of which are formally described and organized according to the relational model. In contrast, a NoSQL database is a database that provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases. NoSQL databases allow for simplicity of design, horizontal scaling and finer control over availability. They are sometimes preferred over relational databases due to their use of optimized key-value stores that lend to simple retrieval and appending operations.
In some implementations of a NoSQL database, column families are used to represent that data. A column family resembles a table in relational database. Column families contain rows and columns. Each row is uniquely identified by a row key, and each row has multiple columns including a name, value and timestamp. Unlike a table in a relational database, different rows in the same column family do not have to share the same set of columns, and a column may be added to one or multiple rows at a time. Each key in such a NoSQL database corresponds to a value which is an object and each key has values as columns and columns are grouped together into sets known as column families.
Often times, there arises a need to update a NoSQL database. Such updates may involve converting an old column family to a new column family. During such updates, it is important to maintain consistency for all data access to the database.
Typically, in order to maintain consistency for data access, updates to a NoSQL database occur using a lock-based mechanism. A lock is used when multiple users need to access a database concurrently. Any single user can modify those database records to which they have applied a lock that gives them exclusive access to the record until the lock is released. Locking not only provides exclusivity to writes but also prevents reading of unfinished modifications. This prevents data from being corrupted or invalidated when multiple users try to read while others write to the database. However, utilizing a locking mechanism to update a NoSQL database leads to several inefficiencies, the most prominent of which is the amount of downtime required to update the database.